package ar.edu.utn.frba.disenio.gui;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.Dialog;
import org.uqbar.arena.windows.WindowOwner;
import ar.edu.utn.frba.disenio.model.Asiento;

@SuppressWarnings("serial")
public abstract class ErrorOperacionWindow extends Dialog<Asiento> {
	
	public abstract String getOperacion();
	String error;
	
	public ErrorOperacionWindow(WindowOwner owner, Asiento model, String error) {
		super(owner, model);
		this.error = error;
	}

	@Override
	protected void createFormPanel(Panel mainPanel) {
		this.setTitle("Aterrizar.com");
		
		new Label(mainPanel)
			.setText("Ha ocurrido un error en su " + this.getOperacion() + ": " + this.getError());
		
		new Label(mainPanel)
			.setText("Por favor intente nuevamente");
		
		new Button(mainPanel)
			.setCaption("Aceptar")
			.onClick(new MessageSend(this, "close"));
	}
	
	public String getError() {
		return this.error;
	}

	
}
